<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <!-- load 依赖的库 -->
    <script src="../libs/system.js"></script>
    <script>
        System.import('../libs/cc.js');
    </script>

    <!-- load 一些工具函数 -->
    <script src="../src/utils/gltfParser.js"></script>
    <script src="../src/utils/ajax.js"></script>
    <script src="../src/utils/globalCache.js"></script>
    <script src="../src/utils/geoUtils.js"></script>

    <!-- load需要的 -->
    <script src="../src/debugUtils.js"></script>
    <!--<script src="../src/graphics.js"></script>-->
    <script src="../src/v1/camera.js"></script>
    <script src="../src/v1/rendererV1.js"></script>
    <script src="../src/v1/mesh.js"></script>

    <script src="../src/v1/g2d_ground.js"></script>
    <script src="../src/v1/g3d.js"></script>
    <script src="../src/v1/template_2d.js"></script>

    <script>
        let renderer,camera;
        let g3d;
        app.init = function () {

            // init graphics
            g3d = new Graphics3d(__imageData);
            window.graphics = g3d;

            // init camera
            camera  = new Camera();
            camera.lookAt(cc.v3(0,2,5),cc.v3(),cc.Vec3.UNIT_Y);

            const fov = 60 * Math.PI / 180;
            const aspect = this.width / this.height;
            camera.project(fov,aspect,0.1,1000);

            // init renderer
            renderer = new RendererV1(camera);

            // init mesh
            GLTFLoader.load('./assets/ground_8.gltf',(err,meshInfo)=>{
                if(err) throw err;
                let mesh = new Mesh(meshInfo);
                mesh._debugDraw = false;
                renderer.add(mesh);
            });
        };
        app.render = function () {
            g3d.clear();
            renderer.render();
        }
    </script>

</head>
<body>

</body>
</html>
